#include<bits/stdc++.h>

using namespace std;

class Solution {
public:
    vector<bool> canEat(vector<int> &candiesCount, vector<vector<int>> &queries) {
        int N = candiesCount.size();
        vector<unsigned long long> sum(N, 0);
        sum[0] = candiesCount[0];
        for (int i = 1; i < N; ++i)
            sum[i] = sum[i - 1] + candiesCount[i];
        vector<bool> ans;
        for (auto &query:queries) {
            unsigned long long fType = query[0];
            unsigned long long fDay = query[1];
            unsigned long long cap = query[2];
            unsigned long long daysBefore = fDay;
            unsigned long long lastCount = fType != 0 ? sum[fType - 1] : 0;
            ans.push_back(daysBefore < sum[fType] && (daysBefore +1) * cap >= lastCount);
        }
        return ans;
    }
};

int main() {
    Solution solution;
    vector<int> candiesCount = {13, 45, 31, 29, 13, 20, 11, 33, 18, 13, 10, 39, 43, 36, 5, 38, 27, 38, 10, 33, 46, 17,
                                20, 28, 41, 29, 3, 35, 38, 46, 32, 7, 37, 5, 27, 15, 46, 9, 11, 37, 47, 44, 48, 34, 37,
                                12, 3, 37, 29, 25, 7, 34, 45, 23, 17, 10, 46, 5, 37, 34, 5, 45, 5};
    vector<vector<int>> queries = {
            {0,  2, 2},
            {4,  2, 4},
            {13, 4, 91}
    };
    solution.canEat(candiesCount, queries);
}